package net.liteheaven.conflict;

import android.app.Activity;
import android.widget.Toast;

import java.lang.ref.WeakReference;

/**
 * 看看在插件中搞个同名类是啥效果
 * 结果：这个被覆盖
 */
public class ConflictUtil {

    private static WeakReference<Toast> last = null;

    public static void showToast(Activity a){
        Toast lastWeak = last != null ? last.get() : null;
        if (lastWeak != null){
            lastWeak.cancel();
        }

        Toast t = Toast.makeText(a, "b", Toast.LENGTH_LONG);
        last = new WeakReference<>(t);
        t.show();
    }
}
